JavaScript

A5.u.htmlescape Method

Syntax

A5.u.html.escape(value)

Arguments

valuestring

The string to replace HTML characters in.

Returns

valuestring

The string with HTML characters replaced.

Description

Escape HTML in a string.

Discussion

This method will take an arbitrary string and escape all HTML characters that it is safe to inject into HTML.

Example

var str = 'arg1 <= 3 && arg2 > 5';
var html = A5.u.html.escape(str);
// html = "arg1 &lt;= 3 &amp;&amp; arg2 &gt; 5"